<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>预览并编辑薪资信息</title>
  <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
  <h2>预览并编辑薪资信息</h2>
  {% if error %}
  <div class="alert alert-danger">{{ error }}</div>
  {% endif %}
  <form method="POST" action="{{ url_for('salary.confirm_upload') }}">
    <input type="hidden" name="row_count" value="{{ row_count }}">
    <table class="table table-bordered">
      <thead>
      <tr>
        <th>公司</th><th>职位</th><th>城市</th><th>月薪(k)</th><th>月数</th>
        <th>年终奖(k)</th><th>签字费(k)</th><th>股票期权</th><th>类型</th>
        <th>学历</th><th>行业</th><th>备注</th>
      </tr>
      </thead>
      <tbody>
      {# 直接遍历 data_list，使用 loop.index0 生成索引 #}
      {% for row in data_list %}
      {% set idx = loop.index0 %}
      <tr>
        <td><input name="company-{{ idx }}" value="{{ row.company }}" class="form-control"></td>
        <td><input name="position-{{ idx }}" value="{{ row.position }}" class="form-control"></td>
        <td><input name="city-{{ idx }}" value="{{ row.city }}" class="form-control"></td>
        <td><input name="base_salary-{{ idx }}" value="{{ row.base_salary }}" class="form-control"></td>
        <td><input name="months-{{ idx }}" value="{{ row.months }}" class="form-control"></td>
        <td><input name="bonus-{{ idx }}" value="{{ row.bonus }}" class="form-control"></td>
        <td><input name="signing_bonus-{{ idx }}" value="{{ row.signing_bonus }}" class="form-control"></td>
        <td><input name="stock-{{ idx }}" value="{{ row.stock }}" class="form-control"></td>
        <td><input name="type-{{ idx }}" value="{{ row.type }}" class="form-control"></td>
        <td><input name="education-{{ idx }}" value="{{ row.education }}" class="form-control"></td>
        <td><input name="industry-{{ idx }}" value="{{ row.industry }}" class="form-control"></td>
        <td><input name="remark-{{ idx }}" value="{{ row.remark }}" class="form-control"></td>
      </tr>
      {% endfor %}
      </tbody>
    </table>
    <button type="submit" class="btn btn-success">确认上传</button>
  </form>
</div>
</body>
</html>